void difftest_skip_dut(int nr_ref, int nr_dut);
static inline def_EHelper(lui)
{
  rtl_li(s, ddest, id_src2->imm << 16);
  print_asm_template3(lui);
}

static inline def_EHelper(addi)
{
  reg_l(s->isa.instr.r.rt) = reg_l(s->isa.instr.r.rs) + s->isa.instr.i.simm;
  print_asm_template3(addi);
}
static inline def_EHelper(slti)
{
  reg_l(s->isa.instr.r.rt) = (int)reg_l(s->isa.instr.r.rs) < (int)s->isa.instr.i.simm;
  print_asm_template3(slti);
}
static inline def_EHelper(sltiu)
{
  reg_l(s->isa.instr.r.rt) = reg_l(s->isa.instr.r.rs) < s->isa.instr.i.simm;
  print_asm_template3(sltiu);
}
static inline def_EHelper(andi)
{
  reg_l(s->isa.instr.r.rt) = reg_l(s->isa.instr.r.rs) & s->isa.instr.iu.imm;
  print_asm_template3(andi);
}
static inline def_EHelper(ori)
{
  reg_l(s->isa.instr.r.rt) = reg_l(s->isa.instr.r.rs) | s->isa.instr.iu.imm;
  print_asm_template3(ori);
}
static inline def_EHelper(xori)
{
  reg_l(s->isa.instr.r.rt) = reg_l(s->isa.instr.r.rs) ^ s->isa.instr.iu.imm;
  print_asm_template3(xori);
}
static inline def_EHelper(beq)
{
  if (reg_l(s->isa.instr.r.rs) == reg_l(s->isa.instr.r.rt))
  {
    cpu.is_cond = 1;
    cpu.cond_pc = (cpu.pc + 4 + (s->isa.instr.i.simm << 2));
  }
  print_asm_template3(beq);
  // else
  // {
  //   s->seq_pc += 4;
  // }
  // difftest_skip_dut(2, 1);
}
static inline def_EHelper(bne)
{
  if (reg_l(s->isa.instr.r.rs) != reg_l(s->isa.instr.r.rt))
  {
    cpu.is_cond = 1;
    cpu.cond_pc = (cpu.pc + 4 + (s->isa.instr.i.simm << 2));
  }
  print_asm_template3(bne);
  // else
  // {
  //   s->seq_pc += 4;
  // }
  // difftest_skip_dut(2, 1);
}
static inline def_EHelper(bgez)
{
  if (s->isa.instr.r.rt == 0b00001)
  {
    if ((int)reg_l(s->isa.instr.r.rs) >= 0) // bgez
    {
      cpu.is_cond = 1;
      cpu.cond_pc = (cpu.pc + 4 + (s->isa.instr.i.simm << 2));
    }
    print_asm_template3(bgez);
    // else
    // {
    //   s->seq_pc += 4;
    // }
  }
  else if (s->isa.instr.r.rt == 0b00000) // bltz
  {
    if ((int)reg_l(s->isa.instr.r.rs) < 0)
    {
      cpu.is_cond = 1;
      cpu.cond_pc = (cpu.pc + 4 + (s->isa.instr.i.simm << 2));
    }
    print_asm_template3(bltz);
    // else
    // {
    //   s->seq_pc += 4;
    // }
  }
  else if (s->isa.instr.r.rt == 0b10001) // bgezal
  {
    cpu.gpr[31]._32 = cpu.pc + 8;
    if ((int)reg_l(s->isa.instr.r.rs) >= 0)
    {
      cpu.is_cond = 1;
      cpu.cond_pc = (cpu.pc + 4 + (s->isa.instr.i.simm << 2));
    }
    print_asm_template3(bgezal);
    // else
    // {
    //   s->seq_pc += 4;
    // }
  }
  else if (s->isa.instr.r.rt == 0b10000) // bltzal
  {
    cpu.gpr[31]._32 = cpu.pc + 8;
    if ((int)reg_l(s->isa.instr.r.rs) < 0)
    {
      cpu.is_cond = 1;
      cpu.cond_pc = (cpu.pc + 4 + (s->isa.instr.i.simm << 2));
    }
    print_asm_template3(bltzal);
    // else
    // {
    //   s->seq_pc += 4;
    // }
  }
  // difftest_skip_dut(2, 1);
}
static inline def_EHelper(bgtz)
{
  if ((int)reg_l(s->isa.instr.r.rs) > 0)
  {
    cpu.is_cond = 1;
    cpu.cond_pc = (cpu.pc + 4 + (s->isa.instr.i.simm << 2));
  }
  print_asm_template3(bgtz);
  // else
  // {
  //   s->seq_pc += 4;
  // }
  // difftest_skip_dut(2, 1);
}
static inline def_EHelper(blez)
{
  if ((int)reg_l(s->isa.instr.r.rs) <= 0)
  {
    cpu.is_cond = 1;
    cpu.cond_pc = (cpu.pc + 4 + (s->isa.instr.i.simm << 2));
  }
  print_asm_template3(blez);
  // else
  // {
  //   s->seq_pc += 4;
  // }
  // difftest_skip_dut(2, 1);
}
static inline def_EHelper(j)
{
  cpu.is_cond = 1;
  cpu.cond_pc = ((cpu.pc & 0xF0000000) | (id_src1->imm << 2));
  print_asm_template1(j);
  // difftest_skip_dut(2, 1);
}
static inline def_EHelper(jal)
{
  cpu.is_cond = 1;
  cpu.gpr[31]._32 = cpu.pc + 8;
  cpu.cond_pc = ((cpu.pc & 0xF0000000) | (id_src1->imm << 2));
  print_asm_template1(jal);
  // difftest_skip_dut(2, 1);
}
